package com.ds.infrastructure.hyperspace.common.flow.handler;

import com.ds.infrastructure.hyperspace.common.EndpointNode;
import com.ds.infrastructure.hyperspace.common.config.TargetNodeConfig;
import com.ds.infrastructure.hyperspace.common.flow.DuplexFlowContext;
import com.ds.infrastructure.hyperspace.common.flow.TargetNodeWrapper;

import java.util.List;
import java.util.Map;

/**
 * @author  Weishaoying
 */
public interface LoadBalancePreFlowHandler<C extends DuplexFlowContext> extends PreFlowHandler {

    /**
     * select a Node
     * @param duplexFlowContext
     * @param connectionList
     * @param nodeContextMap
     * @return
     */
    EndpointNode<TargetNodeConfig> select(C duplexFlowContext,
            List<EndpointNode<TargetNodeConfig>> connectionList,
            Map<String, ? extends TargetNodeWrapper> nodeContextMap);

}
